Skip to content

feat(vpto): add A2/A3 gather lowering#2

Closed
castigli wants to merge 3 commits into
mainfrom
feature/a2a3-tgather-mgather-vpto
Closed

feat(vpto): add A2/A3 gather lowering#2
castigli wants to merge 3 commits into
mainfrom
feature/a2a3-tgather-mgather-vpto

Conversation

@castigli

Copy link
Copy Markdown
Owner

Summary

  • Add A2/A3 VPTO flat-UB lowering infrastructure and gather support.
  • Add pto.ub.vgather / pto.ub.vgatherb ops and lower them to packed llvm.hivm.VGATHER{B}.b16/.b32 calls.
  • Lower pto.tgather index form through vmuls + vgather, preserving count-mode mask lifetime and chunking wide rows.
  • Lower pto.tgatherb with CCE block-gather semantics: one compact 32B block address per output 32B block, padded to 8 address entries.
  • Add verifier checks, lit coverage, PTODSL helpers, and NPU e2e tests.

Notes

  • tgatherb is a 32B block gather, not scalar gather. The offset tile uses compact i32 32B-aligned block addresses.
  • Scalar arbitrary element gather is covered by tgather index form / vgather.
  • A2/A3 mgather remains out of scope because it is A5-only.

Validation

  • Targeted ptoas/FileCheck gather lit checks: pass.
  • NPU e2e on 910B2 devices 6/7:
pytest -q ptodsl/tests/e2e/test_gather.py -s
15 passed in 55.50s

Covered NPU shapes:

  • tgatherb f32: 1x8, 1x64, 1x96, 2x64, 1x128, 4x64
  • tgatherb f16: 1x16, 1x128, 1x192
  • scalar tgather f32/f16: 1x64, 2x64, 2x128

@castigli
castigli force-pushed the feature/a2a3-tgather-mgather-vpto branch 3 times, most recently from f6615ce to 23d4248 Compare July 16, 2026 15:05
@castigli
castigli force-pushed the feature/a2a3-tgather-mgather-vpto branch from 23d4248 to 1b99042 Compare July 20, 2026 13:58
@castigli
castigli force-pushed the feature/a2a3-tgather-mgather-vpto branch from 1b99042 to 2f62fac Compare July 21, 2026 11:39
@castigli
castigli changed the base branch from feature/a2a3-llvm to main July 21, 2026 11:39
@castigli
castigli force-pushed the feature/a2a3-tgather-mgather-vpto branch from 2f62fac to 91e27d0 Compare July 21, 2026 11:42
@castigli
castigli force-pushed the feature/a2a3-tgather-mgather-vpto branch from 91e27d0 to 796c9db Compare July 21, 2026 13:15
@castigli

Copy link
Copy Markdown
Owner Author

Superseded by the canonical upstream PR: hw-native-sys#971

@castigli castigli closed this Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants